import Vue from 'vue';
import Router from 'vue-router';
import MgtLogin from '@/views/manage/Login.vue';
import MgtIndexLayout from '@/views/manage/IndexLayout.vue';
import MgtIdx401 from '@/views/manage/indexLayout/401.vue';
import MgtIdx404 from '@/views/manage/indexLayout/404.vue';
import MgtIdxHome from '@/views/manage/indexLayout/Home.vue';
import MgtIdxSysUser from '@/views/manage/indexLayout/User.vue';
import MgtIdxSysRole from '@/views/manage/indexLayout/Role.vue';
import MgtIdxSysMenu from '@/views/manage/indexLayout/Menu.vue';
import MgtIdxSysPersonInfo from '@/views/manage/indexLayout/PersonInfo.vue';
import MgtIdxSysPersonPwd from '@/views/manage/indexLayout/PersonPwd.vue';

import liveVideo from '@/views/manage/indexLayout/liveVideo.vue';
import playbackVideo from '@/views/manage/indexLayout/playbackVideo.vue';
import sysSet from '@/views/manage/indexLayout/sysSet.vue';
import setVideo from '@/views/manage/indexLayout/setVideo.vue';

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};
Vue.use(Router);


export default new Router({
    routes: [{
            path: '/',
            name: 'MgtLogin',
            component: MgtLogin,
        },
        {
            path: '/mgt/index',
            name: 'MgtIndex',
            component: MgtIndexLayout,
            meta: { authc: true, authz: true },
            redirect: '/mgt/index/liveVideo',
            children: [{
                    path: '/mgt/index/home',
                    name: 'MgtIdxHome',
                    component: MgtIdxHome,
                },
                {
                    path: '/mgt/index/401',
                    name: 'MgtIdx401',
                    component: MgtIdx401,
                },
                {
                    path: '/mgt/index/404',
                    name: 'MgtIdx404',
                    component: MgtIdx404,
                },
                {
                    path: '/mgt/index/role',
                    name: 'MgtIdxSysRole',
                    component: MgtIdxSysRole,
                },
                {
                    path: '/mgt/index/user',
                    name: 'MgtIdxSysUser',
                    component: MgtIdxSysUser,
                },
                {
                    path: '/mgt/index/menu',
                    name: 'MgtIdxSysMenu',
                    component: MgtIdxSysMenu,
                },
                {
                    path: '/mgt/index/person/info',
                    name: 'MgtIdxSysPersonInfo',
                    component: MgtIdxSysPersonInfo,
                },
                {
                    path: '/mgt/index/person/pwd',
                    name: 'MgtIdxSysPersonPwd',
                    component: MgtIdxSysPersonPwd,
                },
                {
                    path: '/mgt/index/liveVideo',
                    name: 'liveVideo',
                    component: liveVideo,
                },
                {
                    path: '/mgt/index/playbackVideo',
                    name: 'playbackVideo',
                    component: playbackVideo,
                },
                {
                    path: '/mgt/index/sysSet',
                    name: 'sysSet',
                    component: sysSet //下载,
                },
                {
                    path: '/mgt/index/setVideo',
                    name: 'setVideo',
                    component: setVideo //下载,
                },

            ],
        },
    ],
});